package com.sinya.shoppingmall.https;

import com.sinya.shoppingmall.bean.BaseResult;

/**
 * @author KoizumiSinya
 * @date 2015/12/19
 */
public class VolleyParams {

    public static final int GET = 0;
    public static final int POST = 1;

    /**
     * API请求分支节点
     */
    public String cmd;

    /**
     * 请求方式
     */
    public int invokeMethod;

    /**
     * 是否封装了实体Bean
     */
    public Class<?> parseClass;

    /**
     * 请求时是否需要封装请求头
     */
    public boolean hadHeader;

    /**
     * 是否需要请求参数
     */
    public boolean hadParams;

    /**
     * 请求头
     */
    public String[] headerName;

    /**
     * 需要提交的参数的键
     */
    public String[] paramName;

    // [+] 构造函数

    public VolleyParams(int invokeMethod, String cmd) {

        this.hadHeader = false;
        this.hadParams = false;

        this.invokeMethod = invokeMethod;
        this.cmd = cmd;
        this.parseClass = BaseResult.class;
    }


    public VolleyParams(int invokeMethod, String cmd, String[] headerName, String[] paramName) {

        this.hadHeader = headerName == null ? false : true;
        this.hadParams = paramName == null ? false : true;

        this.invokeMethod = invokeMethod;
        this.cmd = cmd;
        this.headerName = headerName;
        this.paramName = paramName;
        this.parseClass = BaseResult.class;
    }

    // [-] 构造函数
    // [+]  请求实例

    /**
     * 1.2
     * 首页〇
     */
    public static VolleyParams home = new VolleyParams(GET, "home");

    /**
     * 1.3.1
     * 搜索推荐〇
     */
    public static VolleyParams searchRecommend = new VolleyParams(GET, "search/recommend");

    /**
     * 1.3.2
     * 搜索商品列表〇
     */
    public static VolleyParams search = new VolleyParams(POST, "search", null, new String[]{"keyword", "page", "pageNum", "orderby"});

    /**
     * 1.4.1
     * 促销快报（打折促销）〇
     */
    public static VolleyParams topic = new VolleyParams(POST, "topic", null, new String[]{"page", "pageNum"});

    /**
     * 1.4.1.1
     * 专题商品列表
     */
    public static VolleyParams topicList = new VolleyParams(POST, "topic/plist", null, new String[]{"page", "pageNum", "id", "orderby"});

    /**
     * 1.4.2
     * 推荐品牌〇
     */
    public static VolleyParams brand = new VolleyParams(GET, "brand");

    /**
     * 1.4.2.1
     * 品牌商品列表（正品专柜）〇
     */
    public static VolleyParams brandList = new VolleyParams(POST, "brand/plist", null, new String[]{"page", "pageNum", "id", "orderby"});

    /**
     * 1.4.3
     * 限时抢购〇
     */
    public static VolleyParams limitbuy = new VolleyParams(POST, "limitbuy", null, new String[]{"page", "pageNum"});

    /**
     * 1.4.4
     * 新品上架（新品发布）〇
     */
    public static VolleyParams newproduct = new VolleyParams(POST, "newproduct", null, new String[]{"page", "pageNum", "orderby"});

    /**
     * 1.4.5
     * 热门单品（换季降价）〇
     */
    public static VolleyParams hotproduct = new VolleyParams(POST, "hotproduct", null, new String[]{"page", "pageNum", "orderby"});

    /**
     * 1.5.1
     * 分类请求
     */
    public static VolleyParams category = new VolleyParams(GET, "category");

    /**
     * 1.5.2
     * 商品列表
     */
    public static VolleyParams productList = new VolleyParams(POST, "productlist", null, new String[]{"page", "pageNum", "cId", "orderby", "filter"});

    /**
     * 1.5.3
     * 商品详情
     */
    public static VolleyParams product = new VolleyParams(POST, "product", null, new String[]{"pId"});

    /**
     * 1.5.4
     * 商品描述
     */
    public static VolleyParams productDescription = new VolleyParams(POST, "product/description", null, new String[]{"pId"});

    /**
     * 1.5.5
     * 商品评论
     */
    public static VolleyParams productComment = new VolleyParams(POST, "product/comment", null, new String[]{"pId", "page", "pageNum"});

    /**
     * 1.5.6
     * 商品收藏
     */
    public static VolleyParams productFavorites = new VolleyParams(POST, "product/favorites", new String[]{"userid"}, new String[]{"pId"});

    /**
     * 1.6.1
     * 进入购物车
     */
    public static VolleyParams cart = new VolleyParams(POST, "cart", null, new String[]{"sku"});

    /**
     * 1.6.2
     * 修改数量
     */
    public static VolleyParams commitCart = new VolleyParams(POST, "cart", null, new String[]{"sku"});

    /**
     * 1.6.3
     * 删除商品
     */
    public static VolleyParams deleteProduct = new VolleyParams(POST, "cart", null, new String[]{"sku"});

    /**
     * 1.7.1
     * 结算中心信息
     */
    public static VolleyParams checkout = new VolleyParams(POST, "checkout", new String[]{"userid"}, new String[]{"sku"});

    /**
     * 1.7.2
     * 提交结算
     */
    public static VolleyParams ordersumbit = new VolleyParams(POST, "ordersumbit", new String[]{"userid"},//
            new String[]{"sku", "addressId", "paymentType", "deliveryType", "invoiceType", "invoiceTitle", "invoiceContent"});

    /**
     * 1.7.3
     * 发票
     */
    public static VolleyParams invoice = new VolleyParams(GET, "invoice");

    /**
     * 1.8.1
     * 登陆
     */
    public static VolleyParams login = new VolleyParams(POST, "login", null, new String[]{"username", "password"});

    /**
     * 1.8.2
     * 注册
     */
    public static VolleyParams register = new VolleyParams(POST, "register", null, new String[]{"username", "password"});

    /**
     * 1.8.3
     * 账户中心
     */
    public static VolleyParams userinfo = new VolleyParams(POST, "userinfo", new String[]{"userid"}, null);

    /**
     * 1.8.4
     * 注销
     */
    public static VolleyParams logout = new VolleyParams(POST, "logout", new String[]{"userid"}, null);

    /**
     * 1.8.5
     * 激活接口
     */
    public static VolleyParams active = new VolleyParams(GET, "active", null, new String[]{"imei"});

    /**
     * 1.8.6
     * 激活接口
     */
    public static VolleyParams version = new VolleyParams(GET, "version");

    /**
     * 1.8.7
     * 收藏夹
     */
    public static VolleyParams favorites = new VolleyParams(POST, "favorites", new String[]{"userid"}, new String[]{"page", "pageNum"});

    /**
     * 1.9.1
     * 获取订单列表
     */
    public static VolleyParams orderList = new VolleyParams(POST, "orderlist", new String[]{"userid"}, new String[]{"type", "page", "pageNum"});

    /**
     * 1.9.2
     * 订单详情
     */
    public static VolleyParams orderDetail = new VolleyParams(POST, "orderdetail", new String[]{"userid"}, new String[]{"orderId"});

    /**
     * 1.9.3
     * 取消订单
     */
    public static VolleyParams orderCancel = new VolleyParams(POST, "ordercancel", new String[]{"userid"}, new String[]{"orderId"});

    /**
     * 1.9.4
     * 物流查询
     */
    //public static VolleyParams logistics = new VolleyParams(POST, "logistics",/* new String[]{"userid"}*/null, new String[]{"orderId"});

    /**
     * 2.0.1
     * 地址列表
     */
    public static VolleyParams addressList = new VolleyParams(POST, "addresslist", new String[]{"userid"}, null);

    /**
     * 2.0.2
     * 地址三级列表
     */
    public static VolleyParams addressArea = new VolleyParams(POST, "addressarea", null, new String[]{"id"});

    /**
     * 2.0.3
     * 地址修改/保存
     */
    public static VolleyParams addressSave = new VolleyParams(POST, "addresssave", new String[]{"userid"},//
            new String[]{"id", "name", "phoneNumber", "province", "city", "addressArea", "addressDetail", "zipCode", "isDefault"});

    /**
     * 2.0.4
     * 设置默认地址
     */
    public static VolleyParams addressDefault = new VolleyParams(POST, "addressdefault", new String[]{"userid"}, new String[]{"id"});

    /**
     * 2.0.4
     * 删除地址
     */
    public static VolleyParams addressDelete = new VolleyParams(POST, "addressdelete", new String[]{"userid"}, new String[]{"id"});

    /**
     * 2.1.1
     * 帮助列表
     */
    public static VolleyParams help = new VolleyParams(POST, "help");

    /**
     * 2.1.2
     * 帮助内容
     */
    public static VolleyParams helpDetail = new VolleyParams(POST, "helpDetail", null, new String[]{"id"});

    // [-] 请求实例
}
